#!/bin/bash
# ref: http://poormansprofiler.org/
set -euo pipefail
name=$(basename $0)
[ $# -ne 1 ] && {
  echo "Usage: ${name} PID(show-user-stack(s)-of-this-process)"
  exit 1
}
sudo gdb \
  -ex "set pagination 0" \
  -ex "thread apply all bt" \
  --batch -p ${1}
